Skip to content

feat: compat.websocket server + zlib features (gated; server implies zlib) - #159

Merged
Sunrisepeak merged 1 commit into
mcpplibs:mainfrom
FarnaHerry:feat/compat-websocket-features
Aug 5, 2026
Merged

feat: compat.websocket server + zlib features (gated; server implies zlib)#159
Sunrisepeak merged 1 commit into
mcpplibs:mainfrom
FarnaHerry:feat/compat-websocket-features

Conversation

@FarnaHerry

Copy link
Copy Markdown
Collaborator

Summary

Adds two optional, gated features to compat.websocket (#158), keeping the zero-dependency client build as the default:

  • server — compiles the four server TUs the base build leaves out (IXWebSocketServer / IXSocketServer / IXHttpServer / IXWebSocketProxyServer). Verified against the four .cpp files: only stdlib + already-compiled IX headers, so zero new external deps. Consumers get ix::WebSocketServer (derives from SocketServer, so getPort() etc. work).
  • zlibdefines = { "IXWEBSOCKET_USE_ZLIB=1" } + deps = { ["compat.zlib"] = "1.3.2" }, turning the gzip codec from its no-op into real permessage-deflate compression. The define reaches the package's own TUs; consumers need no define.

server implies zlib — a correctness trap found by reading upstream: IXWebSocketServer enables permessage-deflate by default, and the transport's extension negotiation is not gated on IXWEBSOCKET_USE_ZLIB (only the codec is). A server built without the define would advertise compression it cannot perform, so implies = { "zlib" } keeps every server build capable of what it advertises.

This branch stacks on #158 (feat/compat-websocket). Merge #158 first; then this PR's diff against main shrinks to just the feature additions.

Test coverage

New workspace member tests/examples/websocket-features (deps with features = ["server", "zlib"]), fully offline on loopback:

  • Real ix::WebSocketServer round-trips (text + binary) through the compiled-in server.
  • Compression is observable on the wire: a 64 KiB repeated-byte payload round-trips with message.str.size() == 65536 and wireSize == 80 (the transport reports wireSize = raw frame payload, str = decompressed content).

Negative verification: the default (no-feature) member's build has no IXWebSocketServer.o / IXSocketServer.o / IXHttpServer.o / IXWebSocketProxyServer.o, and nm over all its objects finds no server symbols — referencing the server without the feature fails at link time.

Verification (CI-pinned mcpp 2026.8.3.3 + gcc@16.1.0, MCPP_INDEX_MIRROR=GLOBAL, MCPP_BUILD_CACHE=local)

mcpp xpkg parse pkgs/c/compat.websocket.lua   →  parse OK (3 platforms / 12.0.1 / c++23 / 32 sources + 2 features)
mcpp test -p websocket                        →  test result ok. 1 passed; 0 failed   (default base, regression)
mcpp test -p websocket-features               →  test result ok. 1 passed; 0 failed   (server + zlib)

All lint scripts pass (syntax, required fields, no leading-v, mirror, package name, cross-package refs — the new compat.zlib reference resolves).

Follow-ups (not in this PR)

  • wss/TLS feature (deferred, per plan — the only one that meaningfully slows CI, via compat.openssl).
  • CN mirror for the tarball once mcpp-res write access exists.

@FarnaHerry
FarnaHerry force-pushed the feat/compat-websocket-features branch from 293ef5f to 2095650 Compare August 5, 2026 17:56
@Sunrisepeak
Sunrisepeak merged commit e760383 into mcpplibs:main Aug 5, 2026
5 checks passed
Sunrisepeak added a commit that referenced this pull request Aug 5, 2026
main 上合入了 #159(compat.websocket)与 #160(修 xpkg.lua 里那个把 0.0.47/0.0.48
一起吞掉的畸形 0.0.49 条目),分支落后并冲突。

**冲突让 CI 一个 run 都不建** —— GitHub 在 PR 有冲突时算不出 merge ref,于是
`pull_request` 触发的 workflow 完全不启动。表现是 "no checks reported",极易被
误读成 CI 挂了或 push 没生效。

冲突只在两个 README 的同一张表:main 新增了 websocket 那一行,而我改的是同表的
protobuf 那一行。两边都保留。

合并后核验:74 个描述符全部解析通过;members 同时含 protobuf-protoc 与
websocket / websocket-features。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants